home *** CD-ROM | disk | FTP | other *** search
/ Aminet 15 / Aminet 15 - Nov 1996.iso / Aminet / dev / basic / ace24dist.lha / ace24.lha / utils / ab2ascii-1.3 / abasic.h < prev    next >
C/C++ Source or Header  |  1996-09-11  |  3KB  |  121 lines

  1. /*
  2.  *  ABASIC.H
  3.  */
  4.  
  5. /*
  6.  * (c)Copyright 1994 by Tobias Ferber.
  7.  *
  8.  * This file is part of AmigaBASIC->ASCII.
  9.  *
  10.  * AmigaBASIC->ASCII is free software; you can redistribute it and/or
  11.  * modify it under the terms of the GNU General Public License as
  12.  * published by the Free Software Foundation; either version 1 of the
  13.  * License, or (at your option) any later version.
  14.  *
  15.  * AmigaBASIC->ASCII is distributed in the hope that it will be useful,
  16.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  * GNU General Public License for more details.
  19.  *
  20.  * You should have received a copy of the GNU General Public License
  21.  * along with AmigaBASIC->ASCII; see the file COPYING.  If not, write to
  22.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  */
  24.  
  25. #ifndef ABASIC_H
  26.  
  27. #include <ctype.h>
  28. #include <stdio.h>
  29. #include <stdlib.h>
  30. #include <stdarg.h>
  31.  
  32. #ifdef __GNUC__
  33. /* suggested parentheses around assignment used as truth value */
  34. #define if(assignment) if( (assignment) )
  35. #define while(assignment) while( (assignment) )
  36. #endif
  37.  
  38. #define NIL(type)     (type)0L
  39.  
  40. /* AmigaBASIC variable & label symbols */
  41. typedef struct symbol
  42. {
  43.   struct symbol *next;
  44.   int id;      /* coded in 2 bytes */
  45.   char *s;     /* length coded in 1 byte */
  46.  
  47. } symbol_t;
  48.  
  49. #define SYMBOL_SIZE  sizeof(symbol_t)
  50.  
  51. /* AmigaBASIC code lines */
  52. typedef struct codeline
  53. {
  54.   struct codeline *next;
  55.   int len, flags;
  56.   unsigned char *s;
  57.  
  58. } codeline_t;
  59.  
  60. #define CODELINE_SIZE  sizeof(codeline_t)
  61.  
  62.  
  63. /*** / GLOBALS / ***/
  64.  
  65. /* tokens.c */
  66. extern int tok_min, tok_max;  /* 1 byte tokens */
  67. extern int f8_min, f8_max,    /* 2 byte tokens */
  68.            f9_min, f9_max,
  69.            fa_min, fa_max,
  70.            fb_min, fb_max;
  71.  
  72. extern char *tok_tab[], *f8_tab[], *f9_tab[], *fa_tab[], *fb_tab[];
  73.  
  74. /* main.c */
  75. extern symbol_t *sym_tab;         /* gloabal symbol table */
  76. extern int numsyms;               /* #of available symbols */
  77. extern codeline_t *code_buffer;   /* list of code lines */
  78. extern long numlines;             /* #of code lines */
  79. extern long current_line;
  80. extern char *whoami;              /* global copy of argv[0] */
  81. extern char *infile;              /* current input filename */
  82. extern FILE *fin, *fout, *ferr;
  83.  
  84. /*** / PROTOTYPES / ***/
  85.  
  86. #ifndef __P
  87.  
  88. #if defined (__STDC__) || defined(__cplusplus)
  89. #define __P(protos) protos
  90. #else /* !(__STDC__ || __cplusplus) */
  91. #define __P(protos) ()
  92. #endif /* __STDC__ || __cplusplus */
  93.  
  94. #endif /* !__P */
  95.  
  96. /* main.c */
  97. extern void warn __P( (const char *fmt, ...) );
  98.  
  99. /* args.c */
  100. extern char *convert_args __P( (char *) );
  101. extern void display_args __P( (void) );
  102.  
  103. /* flist.c */
  104. extern int chain_fname __P( (char *fname) );
  105. extern char *unchain_fname __P( (void) );
  106. extern void purge_flist __P( (void) );
  107.  
  108. /* symbols.c */
  109. extern int read_sym __P( (FILE *fp, int len, int id) );
  110. extern char *get_sym __P( (int id) );
  111. extern void free_symbols __P( (void) );
  112.  
  113. /* codelines.c */
  114. extern int read_line __P( (FILE *fp, int len, int flags) );
  115. extern void free_code __P( (void) );
  116.  
  117. /* expand.c */
  118. extern void expand_code __P( (void) );
  119.  
  120. #endif /* !ABASIC_H */
  121.